-
-
Couldn't load subscription status.
- Fork 414
Customizable Section #8110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/feature
Are you sure you want to change the base?
Customizable Section #8110
Conversation
…eSection # Conflicts: # src/main/java/ch/njol/skript/lang/SkriptParser.java
|
Labeled as draft to get feedback from others on these changes, incase any of them are extensive changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't checked the code yet, just commenting on the syntax
Problem
With the introduction of
ExpressionSectionin Skript 2.10, a suggestion at the time was to make an item builder section. however there was no way to achieve such without some of the changes that are introduced in this PR. Though this broadens the usage to more than just items.Solution
Overview
This PR makes it possible to customize an object inside a section, allowing that object to be used as a default value and not require
of xfor the elements inside the section. This works by creating an object during#initthat includes the type being customized that is checked for and used within a default context. This makes it safer and easier to write expressions that rely on context, because the right type is already known and enforced.It also helps limit where default values can be used, instead of exposing all possible types through conversion, which could cause issues of confusion.
Adds
ExprSecCustomizableThis class allows the user to input any object that can contain/hold data and customize it in the section, using the respective expressions to the type being built. This does extensive checking and expression handling in
#initensuring that the provided expression can only be used as one type and to check the type is able to be customized.It is imperative that the type is determined during
#initto allow successful parsing and usage of expressions in the section, as this class can be anything.Adds
SectionEventThis class extends
Eventstoring the object being used.Hopefully to be mainstreamed to all
ExpressionSections and/orEffectSections, but some of those classes require special handling, so the current state may not be applicable.This class connects
ExpressionSections toSectionValueExpressionAdds
ExprSectionExpressionSimilar to
ExprEventExpression, this class is only used forSectionValueExpressionAdds
CustomizableRegistryThis class allows registering classes that normally cannot be customized, such as
Enums orRegistries, to be customized as another type. Example:InventoryTypetoInventory.Also includes disallowing classes/types.
Adds
DefaultCustomizablesUtility class for registering and disallowing types during the enabling process of
Skript.Misc
EventValueExpressionfor aBuilder.Testing Completed
ExprSecCustomizable.skquickTestSupporting Information
N/A
Completes: none
Related: none